﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CTManagerSoln
{
    public partial class frmMain : Form
    {

        public frmMain()
        {
            InitializeComponent();
            this.Text = FrmTitle;
        }

        private void createAccount_Click(object sender, EventArgs e)
        {
            frmUserCreateAccount frm = new frmUserCreateAccount(false);
            frm.Show();
        }

        private void phòngBanToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmDonviPhongban frm = new FrmDonviPhongban();
            frm.Show();
        }

        private void chứngTừToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmNhapChungtu frm = new FrmNhapChungtu(false,"");
            frm.Show();
        }

        private void loToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmLoaiChungTu frm = new FrmLoaiChungTu();
            frm.Show();
        }

        private void thoátToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void menuchonphongbanchonhanvien_Click(object sender, EventArgs e)
        {
            FrmUserPhongBan frm = new FrmUserPhongBan();
            frm.Show();
        }

        public static string FrmTitle { get; set; }

        private void menuChungTuCuaToi_Click(object sender, EventArgs e)
        {
            FrmChungTuCuaToi frm = new FrmChungTuCuaToi();
            frm.Show();
        }

        private void frmMain_Load(object sender, EventArgs e)
        {
            if (Commons.isAdmin && Commons.UsernameLogin == "admin")
            {
                this.danhMụcToolStripMenuItem.Visible = true;
                this.chứngTừToolStripMenuItem.Visible = true;
                this.menuChungTuCuaToi.Visible = true;
                this.phòngBanToolStripMenuItem.Visible = true;
                this.loToolStripMenuItem.Visible = true;
                this.accountToolStripMenuItem.Visible = true;
                this.createAccount.Visible = true;
                this.adminToolStripMenuItem.Visible = true;
                menuchonphongbanchonhanvien.Visible = true;
            }
            else
            {
                this.danhMụcToolStripMenuItem.Visible = true;
                this.chứngTừToolStripMenuItem.Visible = true;
                this.menuChungTuCuaToi.Visible = true;
                this.phòngBanToolStripMenuItem.Visible = false;
                this.loToolStripMenuItem.Visible = false;
                this.accountToolStripMenuItem.Visible = false ;
                this.createAccount.Visible = false;
                this.adminToolStripMenuItem.Visible = false;
            }
        }

        private void mnuAccountmanager_Click(object sender, EventArgs e)
        {
            frmAccountManager frm = new frmAccountManager();
            frm.Show();
        }
    }
}
